﻿using System.IO;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
public class EncodingsTest
{
    private const string INPUT_FILE_NAME = @"..\..\..\Encodings\input.txt";
    private const string OUTPUT_FILE_NAME = @"..\..\..\Encodings\output.txt";

    [TestMethod]
    public void SampleTest()
    {
        File.Delete(INPUT_FILE_NAME);
        StreamWriter testFile = new StreamWriter(INPUT_FILE_NAME, false, Encoding.GetEncoding("windows-1251"));
        string sampleText = @"Няква кирилица за тестването
";
        using (testFile)
        {
            testFile.Write(sampleText);
        }
        Encodings.Main();
        StreamReader sr = new StreamReader(OUTPUT_FILE_NAME, Encoding.UTF8);
        string actualText;
        using (sr)
        {
            actualText = sr.ReadToEnd();
        }
        Assert.AreEqual(sampleText, actualText);
    }
}
